# Generic makefile

all: paper.ps 

paper.dvi: paper.tex abstract.tex Encoding.eps Decoding.eps 03-01-05.eps \
           General-Bitmatrix-Coding.eps Matrix.eps Packets.eps

clean:
	rm -f paper.dvi

LIBS = $(HOME)/$(LIB)/$(ARCH)/libfdr.a 
# LIBS = $(LIB)/$(ARCH)/libfdr.a $(LIB)/$(ARCH)/libsf.a

INCLUDE = $(HOME)/include

.SUFFIXES: .c .o .out .hist .jgr .jps .eps .nt .bib .tab .tex .dvi .fig .txt .ps .pdf .bin .od .odh .odd .ppm .gif

.c.o: 
	$(CC) -O -D$(ARCH) -c -I$(INCLUDE) $*.c

.c:
	$(CC) -o $* -O -D$(ARCH) -I$(INCLUDE) $*.c $(LIBS) -lm -lpthread
#	$(CC) -o $* -g -D$(ARCH) -I$(INCLUDE) $*.c $(LIBS) -lm -lpthread -lsocket -lnsl

.tab.tex:
	tabtotex < $*.tab > $*.tex

.bin.od:
	od -b $*.bin +0. > $*.od

.bin.odd:
	od -D $*.bin +0. > $*.odd

.bin.odh:
	od -H $*.bin +0. > $*.odh

.jgr.gif:
	jgrtoppm $*.jgr | ppmtogif > $*.gif

.ps.pdf:
	ps2pdf $*.ps

.ppm.gif:
	ppmtogif < $*.ppm > $*.gif

.eps.gif:
	pstoppm $*.eps | ppmtogif > $*.gif

.ps.gif:
	pstoppm $*.ps | ppmtogif > $*.gif

.jgr.ps:
	jgraph -P < $*.jgr > $*.ps

.jgr.jps:
	jgraph -P < $*.jgr > $*.jps

.jgr.eps:
	jgraph < $*.jgr > $*.eps

.nt.bib:
	mknote $*.nt

.o.out:
	$(CC) -g -o $* -I$(INCLUDE)  $*.o -lm

.c.out:
	$(CC) -g -o $* -I$(INCLUDE)  $*.c -lm

.c.jgr:
	ctojgr $*.c 8 > $*.jgr

.tex.dvi:
	latex $*

texclean:
	rm -f *.aux *.blg *.log

.fig.ps:
	fig2ps < $*.fig > $*.ps

.dvi.ps:
	dvips -t letter -o $*.ps $*.dvi

.hist.jps:
	sh histtops.sh $*.hist > $*.jps

.txt.ps:
	ctojgr $*.txt 12 nb | jgraph -P > $*.ps

.txt.eps:
	ctojgr $*.txt 12 nb | jgraph > $*.eps
